<?php


namespace Modules\Admin\Tests\Feature;


use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\AdminTestCase;

class AuthControllerTest extends AdminTestCase {
    use RefreshDatabase;

    public function testLogin() {

//        $this->mockConsoleOutput = false;
//        $this->artisan('passport:client', ['--password' => true, '--no-interaction' => true]);
//        $this->artisan('passport:keys', ['--no-interaction' => true]);


        $response = $this->postJson(route('api.admin.login'),
            [
                'username' => $this->admin->username,
                'password' => 'admin',
            ]);

        $response->assertStatus(200)->assertJson(['code' => 0, 'msg' => 'success'])
            ->assertJsonStructure(['data' => ['token_type', 'expires_in', 'access_token', 'refresh_token']]);

    }
}
